﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml;
using System.Xml.Linq;
using Business_Object;
using DotNetOpenAuth.OpenId.Extensions.AttributeExchange;

namespace BusinessService
{
    public partial class HomePages : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["FetchResponse"] != null)
            {
                var fetchResponse = Session["FetchResponse"] as FetchResponse;
                if (fetchResponse != null)
                    Label1.Text = fetchResponse.GetAttributeValue(WellKnownAttributes.Contact.Email);
            }
            if (Session["username"] != null)
            {
                Label1.Text = Session["username"].ToString();
            }
            String filePath = HttpContext.Current.Server.MapPath("~/MyPlace/DichVu.xml");

            DichVuService dichVuService = new DichVuService();
            XmlParser xmlParser = new XmlParser();
            XmlDocument doc = xmlParser.ConvertObjectToXml(dichVuService.All());
            doc.Save(filePath);
            
        }
    }
}
